class BookCataModel {
  String _sId;
  String _name;
  String _source;
  String _book;
  String _link;
  List<Chapters> _chapters;
  String _updated;
  String _host;

  BookCataModel(
      {String sId,
        String name,
        String source,
        String book,
        String link,
        List<Chapters> chapters,
        String updated,
        String host}) {
    this._sId = sId;
    this._name = name;
    this._source = source;
    this._book = book;
    this._link = link;
    this._chapters = chapters;
    this._updated = updated;
    this._host = host;
  }

  String get sId => _sId;
  set sId(String sId) => _sId = sId;
  String get name => _name;
  set name(String name) => _name = name;
  String get source => _source;
  set source(String source) => _source = source;
  String get book => _book;
  set book(String book) => _book = book;
  String get link => _link;
  set link(String link) => _link = link;
  List<Chapters> get chapters => _chapters;
  set chapters(List<Chapters> chapters) => _chapters = chapters;
  String get updated => _updated;
  set updated(String updated) => _updated = updated;
  String get host => _host;
  set host(String host) => _host = host;

  BookCataModel.fromJson(Map<String, dynamic> json) {
    _sId = json['_id'];
    _name = json['name'];
    _source = json['source'];
    _book = json['book'];
    _link = json['link'];
    if (json['chapters'] != null) {
      _chapters = new List<Chapters>();
      json['chapters'].forEach((v) {
        _chapters.add(new Chapters.fromJson(v));
      });
    }
    _updated = json['updated'];
    _host = json['host'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['_id'] = this._sId;
    data['name'] = this._name;
    data['source'] = this._source;
    data['book'] = this._book;
    data['link'] = this._link;
    if (this._chapters != null) {
      data['chapters'] = this._chapters.map((v) => v.toJson()).toList();
    }
    data['updated'] = this._updated;
    data['host'] = this._host;
    return data;
  }
}

class Chapters {
  String _id;
  String _title;
  int _time;
  int _partsize;
  int _order;
  String _sId;
  String _link;
  String _chapterCover;
  int _totalpage;
  int _currency;
  bool _unreadble;
  bool _isVip;

  Chapters(
      {String id,
        String title,
        int time,
        int partsize,
        int order,
        String sId,
        String link,
        String chapterCover,
        int totalpage,
        int currency,
        bool unreadble,
        bool isVip}) {
    this._id = id;
    this._title = title;
    this._time = time;
    this._partsize = partsize;
    this._order = order;
    this._sId = sId;
    this._link = link;
    this._chapterCover = chapterCover;
    this._totalpage = totalpage;
    this._currency = currency;
    this._unreadble = unreadble;
    this._isVip = isVip;
  }

  String get id => _id;
  set id(String id) => _id = id;
  String get title => _title;
  set title(String title) => _title = title;
  int get time => _time;
  set time(int time) => _time = time;
  int get partsize => _partsize;
  set partsize(int partsize) => _partsize = partsize;
  int get order => _order;
  set order(int order) => _order = order;
  String get sId => _sId;
  set sId(String sId) => _sId = sId;
  String get link => _link;
  set link(String link) => _link = link;
  String get chapterCover => _chapterCover;
  set chapterCover(String chapterCover) => _chapterCover = chapterCover;
  int get totalpage => _totalpage;
  set totalpage(int totalpage) => _totalpage = totalpage;
  int get currency => _currency;
  set currency(int currency) => _currency = currency;
  bool get unreadble => _unreadble;
  set unreadble(bool unreadble) => _unreadble = unreadble;
  bool get isVip => _isVip;
  set isVip(bool isVip) => _isVip = isVip;

  Chapters.fromJson(Map<String, dynamic> json) {
    _id = json['id'];
    _title = json['title'];
    _time = json['time'];
    _partsize = json['partsize'];
    _order = json['order'];
    _sId = json['_id'];
    _link = json['link'];
    _chapterCover = json['chapterCover'];
    _totalpage = json['totalpage'];
    _currency = json['currency'];
    _unreadble = json['unreadble'];
    _isVip = json['isVip'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this._id;
    data['title'] = this._title;
    data['time'] = this._time;
    data['partsize'] = this._partsize;
    data['order'] = this._order;
    data['_id'] = this._sId;
    data['link'] = this._link;
    data['chapterCover'] = this._chapterCover;
    data['totalpage'] = this._totalpage;
    data['currency'] = this._currency;
    data['unreadble'] = this._unreadble;
    data['isVip'] = this._isVip;
    return data;
  }
}
